package Demo1;

import Demo2.HashBuck;

import java.util.*;

public class Test {
    public static void main(String[] args) {
        HashBuck hashBuck = new HashBuck();
        hashBuck.put(1,1);
        hashBuck.put(3,4);
        hashBuck.put(6,5);
        hashBuck.put(5,1);
        hashBuck.put(12,4);
        hashBuck.put(8,1);
        hashBuck.put(13,13);
        hashBuck.put(7,1);
        hashBuck.put(14,7);

    }
    public static void main3(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("hello");
        set.add("ok");
        set.add("666");
        System.out.println(set);
        for (String s: set){
            System.out.println(s);
        }
    }
    public static void main2(String[] args) {//关于k有序
        Map<String,Integer> map = new TreeMap<>();
        TreeMap<String,Integer> map1 = new TreeMap<>();
        map1.put("this",3);
        map1.put("the",5);
        map1.put("a",7);
        System.out.println(map1);
        int val = map1.get("a");//获取a的val
        System.out.println(val);

        int val1 = map1.getOrDefault("dddd",115544);//有输出value，没有输出115544

        Set<String> set = map1.keySet();
        Collection<Integer> collection = map1.values();

       Set<Map.Entry<String,Integer>> set1 = map1.entrySet();
       for (Map.Entry<String,Integer> stringIntegerEntry: set1){
           System.out.println( "key "+stringIntegerEntry.getKey()+" value "+stringIntegerEntry.getValue());
        }
    }
    public static void main1(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        binarySearchTree.insert(3);
        binarySearchTree.insert(6);
        binarySearchTree.insert(8);
        binarySearchTree.insert(5);
        System.out.println("====");
        binarySearchTree.remove(6);
    }
}
